#指定版本
FROM golang:alpine AS builder
#配置加速
ENV GOPROXY=https://goproxy.cn,direct
#运行创建目录
RUN mkdir ./app
#工作目录
WORKDIR /app

#复制
COPY ./ ./

RUN go mod download

#执行打包
RUN go build main.go

FROM scratch

COPY --from=builder /app/main ./main
COPY --from=builder /app/config.yaml ./config.yaml

CMD ["./main"]
